﻿
Partial Class UserControls_Confirm
    Inherits System.Web.UI.UserControl


#Region "Atributos da pagina"

    Public Property Mensagem() As String
        Get
            Return lit.Text
        End Get
        Set(ByVal value As String)
            lit.Text = value
        End Set
    End Property

    Public Property ShowBotaoSimNao() As Boolean
        Get
            'If ViewState("_showBotaoSimNao") Is Nothing Then ViewState("_showBotaoSimNao") = False
            'Return CBool(ViewState("_showBotaoSimNao"))
            Return btSim.Visible
        End Get
        Set(ByVal value As Boolean)
            'ViewState("_showBotaoSimNao") = value
            'Me.DataBindBotaoSimNao()
            btSim.Visible = value
            btOK.Visible = Not value
            btNao.Visible = btSim.Visible
        End Set
    End Property

    Public Property Largura() As Integer
        Get
            If ViewState("_largura") Is Nothing Then ViewState("_largura") = 400
            Return CInt(ViewState("_largura"))
        End Get
        Set(ByVal value As Integer)
            ViewState("_largura") = value
        End Set
    End Property

    Public Property Altura() As Integer
        Get
            If ViewState("_altura") Is Nothing Then ViewState("_altura") = 300
            Return CInt(ViewState("_altura"))
        End Get
        Set(ByVal value As Integer)
            ViewState("_altura") = value
        End Set
    End Property


#End Region

#Region "Delegates"

    Protected Delegate Sub PageDelegate()

    Private _onClickSim As System.Delegate
    Public Property OnClickSim() As System.Delegate
        Get
            Return _onClickSim
        End Get
        Set(ByVal value As System.Delegate)
            _onClickSim = value
        End Set
    End Property

    Private _onClickNao As System.Delegate
    Public Property OnClickNao() As System.Delegate
        Get
            Return _onClickNao
        End Get
        Set(ByVal value As System.Delegate)
            _onClickNao = value
        End Set
    End Property

#End Region

#Region "Classes Injetadas"

#End Region

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

        If Not IsPostBack Then
            btOK.OnClientClick = "javascript:Fechar" & Me.ID & "();return false;"
        End If

    End Sub

#Region "Funcoes de Databind"

    'Protected Sub DataBindBotaoSimNao()

    '    If Me.ShowBotaoSimNao Then
    '        btSim.Visible = True
    '        btNao.Visible = True
    '    Else
    '        btSim.Visible = False
    '        btNao.Visible = False
    '    End If

    'End Sub

    Public Sub ShowMessage(ByVal _mensagem As String)
        lit.Text = _mensagem
        m1.Show()
        upd.Update()
    End Sub

    Public Sub Show()
        m1.Show()
        upd.Update()
    End Sub

#End Region

#Region "Operacoes do Usuario"

    Protected Sub btSim_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btSim.Click

        If Me.OnClickSim IsNot Nothing Then
            Me.OnClickSim.DynamicInvoke()
        End If

        m1.Hide()

    End Sub

    Protected Sub btNao_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btNao.Click

        If Me.OnClickNao IsNot Nothing Then
            Me.OnClickNao.DynamicInvoke()
        End If

        m1.Hide()

    End Sub

#End Region

#Region "Classes Auxiliares"

#End Region

End Class
